# 第一阶段：构建阶段
FROM golang:1.22 AS builder
WORKDIR /app
COPY . .
RUN go env -w GOPROXY=https://goproxy.cn,direct
RUN go mod tidy
RUN go build -o godco

# 第二阶段：运行阶段
#FROM alpine:latest
FROM debian:sid-slim
WORKDIR /app
COPY --from=builder /app/godco /app/godco
COPY etc /app/etc
COPY static /app/static
EXPOSE 8080
RUN chmod +x /app/godco
CMD ["./godco"]